/*
 * @Description: 登记 - 电子档案存储格式相关接口
 * @Author: Rfan
 * @Date: 2022-11-23 11:27:41
 * @LastEditTime: 2022-11-23 18:35:23
 */

import request from '@/utils/request';
import { Key } from 'react';
import { IPageQuery } from '@/interfaces/global';

export interface IRegERecordStorageListParams {
  archiveTypeId?: number;
  archiveTypeName?: string;
  createTime?: string;
  fileCount?: number;
  folderCount?: number;
  fondsId?: number;
  fondsName?: string;
  fondsNo?: string;
  id?: number;
  operator?: number;
  operatorName?: string;
  operatorTime?: string;
  registrant?: string;
  registrationTime?: string;
  remark?: string;
  storageFormat?: string;
  type?: number;
  year?: string;
}

// 分页查询电子档案存储格式登记列表
export function fetchRegERecordStorageListByPage(data: IPageQuery<IRegERecordStorageListParams>) {
  return request({
    url: `/register-storage-format-count/page`,
    method: 'post',
    data
  });
}

export interface IAddRegERecordStorageParams {
  archiveTypeId: number;
  fileCount: number;
  folderCount: number;
  fondsId: number;
  registrant: string;
  registrationTime: string;
  remark: string;
  storageFormat: string;
  type: number;
  year: string;
}

// 添加电子档案存储格式登记条目
export function addRegERecordStorage(data: IAddRegERecordStorageParams) {
  return request({
    url: `/register-storage-format-count/`,
    method: 'post',
    data
  });
}

export interface IEditRegERecordStorageParams extends IAddRegERecordStorageParams {
  id: number;
}
// 编辑电子档案存储格式登记条目
export function editRegERecordStorage(data: IEditRegERecordStorageParams) {
  return request({
    url: `/register-storage-format-count/`,
    method: 'put',
    data
  });
}

// 删除电子档案存储格式登记条目
export function deleteRegERecordStorageItem(id: Key) {
  return request({
    url: `/register-storage-format-count/${id}`,
    method: 'delete'
  });
}
